/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package viewHandler;

import com.webservice.ParkingPassesBean;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.inject.Named;
import javax.enterprise.context.Dependent;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ComponentSystemEvent;

/**
 *
 * @author Krzysztof
 */
@ManagedBean
@ViewScoped

public class remoteToMobile {
        public remoteToMobile() {
    }
    
    
    
    
@PostConstruct
    public void init(){
             
    } 
    /**
     * Creates a new instance of remoteToMobile
     */
     public void isMobile(ComponentSystemEvent event){
 
//	 serverLog("nowy widok remote");
           String renderKitId = FacesContext.getCurrentInstance().getViewRoot().getRenderKitId();        
        if(renderKitId.equalsIgnoreCase("PRIMEFACES_MOBILE")){
            try
            {
         //       serverLog("przenosi");
                FacesContext.getCurrentInstance().getExternalContext().redirect("/mobile/index.xhtml");
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
	}		

          public void serverLog(String x) {
        Logger.getLogger(ParkingPassesBean.class.getName()).log(Level.SEVERE, "[Carpark2013]: " + x);
    }
   
}
